﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Reflection;
using Pixysoft.Weblications.Sango.Battle;
using Pixysoft.Weblications.Sango.Protocol;
using Pixysoft.Weblications.Sango.Protocol.section;
using Pixysoft.Weblications.Sango.Protocol.stage;

namespace Pixysoft.Weblications.Sango.Command.stage_rve
{
    partial class SangoStageRveHandler
    {
        public stagerve_roomkick stagerve_roomkick(string usercode)
        {
            string creatorUsercode = SangoManager.Authentication();
            stagerve_roomkick response = ReflectionManager.CreatePojo<stagerve_roomkick>();
            response.Succeed = false;

            RveStageTeam team = RveStageController.Instance.TryGetStage(creatorUsercode);
            if (team == null)
            {
                response.Message = "队伍不存在";
                return response;
            }

            if (!team.Creator.Usercode.Equals(creatorUsercode, StringComparison.OrdinalIgnoreCase))
            {
                response.Message = "非队伍创建者";
                return response;
            }

            team = RveStageController.Instance.TryLeaveStage(usercode);
            if (team == null)
            {
                response.Message = "不在队伍中";
                return response;
            }

            response.stage = StageFacade.ToRveStage(team.Stage);
            response.profiles = UsrSectionFacade.ToProfilesByRveStage(team);
            response.creator = UsrSectionFacade.ToProfileByProfile(team.Creator);
            response.iscreator = usercode.Equals(team.Creator.Usercode, StringComparison.OrdinalIgnoreCase);
            response.Succeed = true;
            return response;
        }

    }
    public interface stagerve_roomkick : stagerve_teamlist
    {
    }
}
